package exercise;

import java.util.Scanner;

public class EX06_OOP5 {
	// OOP -접근 제어를 이용한 VO클래스 작성
	/**
	 * setXxx 메서드 작성법 멤버변수명이 name 인 경우 public void setName(String name){
	 * this.name = name; } public void set?????(##### ?????){ this.????? =
	 * ?????; }
	 * 
	 * getXxx 메서드 작성법 멤버변수명이 name 인 경우 public String getName(){ return name; }
	 * public ##### get????(){ return ????; }
	 */
	public static void main(String[] args) {
		SungjukVO sj = new SungjukVO();
		// sj.name = "김태희"; //멤버변수가 private 으로 선언됬었으므로
		// 객체명.변수명으로 사용 불가
		sj.setName("태희");
		// System.out.println(sj.name);
		System.out.println(sj.getName());

		RetangleVO2 r = new RetangleVO2(4, 40, "red");
		System.out.println(r.getWidth());
		System.out.println(r.getHeight());
		System.out.println(r.getColor());
		RetangleService2.getArea1(r.getWidth(), r.getHeight());
		System.out.println(RetangleService2.getArea1(r.getWidth(), r.getHeight()));
		RetangleService2.getPerimeter1(r.getWidth(), r.getHeight());
		System.out.println(RetangleService2.getPerimeter1(r.getWidth(), r.getHeight()));
		
		//FAN
		FanVO02 f = new FanVO02(10, "red",FanVO.FAST , false);
		FanService2.showFanInfo(f.getSpeed(), f.getColor(),f.getRadius(), f.getOn());
		System.out.println(FanService2.showFanInfo(f.getSpeed(), f.getColor(),f.getRadius(), f.getOn()));
		
		//Account02
		AccountVO02 ac = new AccountVO02(1122, 20000, 4.5f);
		AccountService02.getMonthlyinterestTate(ac.getInterestRate());
		System.out.println(AccountService02.getMonthlyinterestTate(ac.getInterestRate()));
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
	}

}

class SungjukVO {
	private String name;
	int kor;
	int eng;
	int mat;

	// setter/getter 메서드 정의
	public void setName(String name) {
		this.name = name;
		// 멤버변수 name에 대한 setter 메서드
	}

	public String getName() {
		return this.name;
	} // 멤버변수 name 에 대한 getter 메서드

}

class RetangleVO2 {
	// 멤버변수
	private float width;
	private float height;
	private String color;
		
	
	// 생성자
	public RetangleVO2() {
		width = 1.0F;
		height = 1.0F;
		color = "white";
	}

	public RetangleVO2(float width,float height,String color) {
		this.width = width;
		this.height = height;
		this.color = color;
	}

	// setter/getter
	public void setWidth(float width) {
		this.width = width;
	}

	public float getWidth() {
		return width;
	}
	

	// setter/getter
	public void setHeight(float height) {
		this.height = height;
	}

	public float getHeight() {
		return height;
	}
	
	public void setColor(String color){
		this.color = color;
	}
	public String getColor(){
		return color;
	}
	
}

class RetangleService2 {
	static float getArea1(float width, float height) {
		return width * height;
	}

	static float getPerimeter1(float width, float height) {
		return 2 * width + 2* height;
	}	

}



class FanVO02 {
	private static final int SLOW = 1;
	private static final int MEDIUM = 2;
	private static final int FAST = 3;
	private int speed;
	private boolean on;
	private float radius;
	private String color;

	public FanVO02() {
	
	speed = this.SLOW;
	on = false;
	radius = 5.0f;
	color = "blue";
	}
	public FanVO02(float radius,String color,int speed,boolean on) {
	this.color = color;
	this.on = on;
	this.radius = radius;
	this.speed = speed;
	}
	public void setRadius(float radius) {
		this.radius = radius;
	}
	public void setColor(String color){
		this.color = color;
	}
	public void setSpeed(int speed) {
		this.speed = speed;
	}
	public void setOn(boolean on) {
		this.on = on;
	}
	public float getRadius() {
		return radius;
	}
	public String getColor(){
		return color;
	}
	public int getSpeed() {
		return speed;
	}
	public boolean getOn() {
		return on;
	}

}
class FanService2{
	static String showFanInfo(int speed, String color, float radius, boolean on){
		String msg = "";
		if(on==true)
		msg =  speed + "," + color + "," + radius + "," + "작동중";
		else
		msg = color + "," + radius + "," + "꺼져있음";
		return msg;
	}
}

class AccountVO02{
	int aid;
	int balance;
	float interestRate;
	String dateCreated;

	public AccountVO02() {
		aid = 0;
		balance = 0;
		interestRate = 0;
		dateCreated = "2013-11-08";
	}
	public AccountVO02(int aid,int balance,float interestRate){
		this.aid = aid;
		this.balance = balance;
		this.interestRate = interestRate;
	}
	public void setAid(int aid){
		this.aid = aid;
	}
	public void setBalance(int balance){
		this.balance = balance;
	}
	public void setInterestRate(float interestRate){
		this.interestRate = interestRate;
	}
	public int getAid(){
		return aid;
	}
	public int getBalance(){
		return balance;
	}
	public float getInterestRate(){
		return interestRate;
	}
}
class AccountService02{
	static float getMonthlyinterestTate(float interestRate){
		return interestRate/12;		
	}
	
}











